#include "mainwindow.h"
#include "ui_mainwindow.h"

#include <QApplication>
#include <QMouseEvent>
#include<QPushButton>
#include<QLineEdit>
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    ui->main2Widget->setHidden(true);
    ui->symbolWidget->setHidden(true);
    ui->numWidget->setHidden(true);
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::on_mainNum_clicked(){
    ui->mainWidget->setHidden(true);
    ui->numWidget->setHidden(false);
}

void MainWindow::on_mainMain2_clicked()
{
    ui->mainWidget->setHidden(true);
    ui->main2Widget->setHidden(false);
}

void MainWindow::on_mainsymbol_clicked()
{
    ui->mainWidget->setHidden(true);
    ui->symbolWidget->setHidden(false);
}
void MainWindow::on_main2Main_clicked()
{
    ui->main2Widget->setHidden(true);
    ui->mainWidget->setHidden(false);
}

void MainWindow::on_main2Num_clicked()
{
    ui->main2Widget->setHidden(true);
    ui->numWidget->setHidden(false);
}

void MainWindow::on_main2symbol_clicked()
{
    ui->main2Widget->setHidden(true);
    ui->symbolWidget->setHidden(false);
}

void MainWindow::on_numSymbol_clicked()
{
    ui->numWidget->setHidden(true);
    ui->symbolWidget->setHidden(false);
}

void MainWindow::on_numMain_clicked()
{
    ui->numWidget->setHidden(true);
    ui->mainWidget->setHidden(false);
}

void MainWindow::on_symbolMain_clicked()
{
    ui->symbolWidget->setHidden(true);
    ui->mainWidget->setHidden(false);
}

void MainWindow::on_space1_clicked()
{
    //连接事件
    QKeyEvent*ke=new QKeyEvent(QKeyEvent::KeyPress,' ',Qt::NoModifier," ");
    //发送事件
    QApplication::postEvent(QApplication::focusWidget(),ke);

}

void MainWindow::on_enter_clicked()
{
    QKeyEvent*ke=new QKeyEvent(QKeyEvent::KeyPress,Qt::Key_Enter,Qt::NoModifier,"");
    QApplication::postEvent(QApplication::focusWidget(),ke);
}

void MainWindow::on_space2_clicked()
{
    QKeyEvent*ke=new QKeyEvent(QKeyEvent::KeyPress,' ',Qt::NoModifier," ");
    QApplication::postEvent(QApplication::focusWidget(),ke);
}

void MainWindow::on_enter2_clicked()
{
    QKeyEvent*ke=new QKeyEvent(QKeyEvent::KeyPress,Qt::Key_Enter,Qt::NoModifier,"");
    QApplication::postEvent(QApplication::focusWidget(),ke);
}

void MainWindow::on_space_clicked()
{
    QKeyEvent*ke=new QKeyEvent(QKeyEvent::KeyPress,' ',Qt::NoModifier," ");
    QApplication::postEvent(QApplication::focusWidget(),ke);
}

void MainWindow::on_backspace_clicked()
{
    QKeyEvent*ke=new QKeyEvent(QKeyEvent::KeyPress, Qt::Key_Backspace,Qt::NoModifier,"");
    QApplication::postEvent(QApplication::focusWidget(),ke);
}

void MainWindow::on_backspace2_clicked()
{
    QKeyEvent*ke=new QKeyEvent(QKeyEvent::KeyPress, Qt::Key_Backspace,Qt::NoModifier,"");
    QApplication::postEvent(QApplication::focusWidget(),ke);
}

void MainWindow::on_space_2_clicked()
{
    QKeyEvent*ke=new QKeyEvent(QKeyEvent::KeyPress, Qt::Key_Backspace,Qt::NoModifier,"");
    QApplication::postEvent(QApplication::focusWidget(),ke);
}

void MainWindow::on_backspace_2_clicked()
{
    QKeyEvent*ke=new QKeyEvent(QKeyEvent::KeyPress, Qt::Key_Backspace,Qt::NoModifier,"");
    QApplication::postEvent(QApplication::focusWidget(),ke);
}

void MainWindow::on_enter_2_clicked()
{
    QKeyEvent*ke=new QKeyEvent(QKeyEvent::KeyPress,Qt::Key_Enter,Qt::NoModifier,"");
    QApplication::postEvent(QApplication::focusWidget(),ke);
}
